<!DOCTYPE html>

<html devsite="">
<head>
<title>tflite::impl::InterpreterBuilder Class Reference</title>
<meta name="page_type" value="reference"/>
<meta content="reference" name="page_type"/></head>
<body>
<div id="top"><!-- do not remove this div --></div>
<h1>tflite::<wbr/>impl::<wbr/>InterpreterBuilder</h1>
<h2>Summary</h2>

<aside class="note">
  <b>Note:</b><code>tflite::impl::InterpreterBuilder</code> class is implementation details. Users should reference it as <code>tflite::InterpreterBuilder</code> instead.</p>
</aside>

<table class="constructors responsive">
<tr>
<th colspan="2">
<h3>Constructors and Destructors</h3>
</th>
</tr>
<tr>
<td colspan="2">
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a3f1ecd25f38ae0c4145a562dcaaa6254">InterpreterBuilder</a>(const FlatBufferModel &amp; model, const <a href="/lite/api_docs/cc/class/tflite/op-resolver.html#classtflite_1_1_op_resolver">OpResolver</a> &amp; op_resolver, const InterpreterOptions *options_experimental)</code>
<br/>
<div>For this constructor, the <a href="/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter">ErrorReporter</a> will be extracted from the FlatBufferModel. </div>
</td>
</tr>
<tr>
<td colspan="2">
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a672da7972a26dc5619d7f25f2a6a1b4d">InterpreterBuilder</a>(const ::tflite::Model *model, const <a href="/lite/api_docs/cc/class/tflite/op-resolver.html#classtflite_1_1_op_resolver">OpResolver</a> &amp; op_resolver, <a href="/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter">ErrorReporter</a> *error_reporter, const InterpreterOptions *options_experimental)</code>
<br/>
<div>Builds an interpreter given only the raw flatbuffer Model object (instead of a FlatBufferModel). </div>
</td>
</tr>
<tr>
<td colspan="2">
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1afe2f489f51bf3398bcc3cf91f0f0b5d6">InterpreterBuilder</a>(const InterpreterBuilder &amp;)</code>
<br/>
</td>
</tr>
<tr>
<td colspan="2">
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1ad58b1346e6dea8205edd0122d3feffb6">~InterpreterBuilder</a>()</code>
<br/>
</td>
</tr>
</table>
<table class="methods responsive">
<tr>
<th colspan="2">
<h3>Public functions</h3>
</th>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1ae95b984f4161de8ebb0f72dde8d82552">AddDelegate</a>(TfLiteDelegate *delegate)</code>
</td>
<td>
<div>
<code>void</code>
</div>
<div>Any delegates added with AddDelegate will be applied to the Interpreter generated by operator(), in the order that they were added. </div>
</td>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a04a03f40adb2cf98096bafac216088d2">AddDelegate</a>(TfLiteOpaqueDelegateStruct *opaque_delegate)</code>
</td>
<td>
<div>
<code>void</code>
</div>
</td>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a6d3ddb354f27e03adc203388d3cbd2d5">SetNumThreads</a>(int num_threads)</code>
</td>
<td>
<div>
<code>TfLiteStatus</code>
</div>
<div>Sets the number of CPU threads to use for the interpreter. </div>
</td>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a8a395b526bb5fdbd126d76e6c941a22d">SetTelemetryProfiler</a>(std::unique_ptr&lt; telemetry::TelemetryProfiler &gt; profiler)</code>
</td>
<td>
<div>
<code>void</code>
</div>
</td>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1affb1f0b3d91c5856c746e04f276e403d">operator()</a>(std::unique_ptr&lt; <a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a2d6d829bce5eba5b241987ca5b4f0f40">Interpreter</a> &gt; *interpreter)</code>
</td>
<td>
<div>
<code>TfLiteStatus</code>
</div>
<div>Builds an interpreter and stores it in <code>*interpreter</code>. </div>
</td>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a9f501d83e33b7f39cfbb5dbf37be0480">operator()</a>(std::unique_ptr&lt; <a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a2d6d829bce5eba5b241987ca5b4f0f40">Interpreter</a> &gt; *interpreter, int num_threads)</code>
</td>
<td>
<div>
<code>TfLiteStatus</code>
</div>
<div>Same as above, but also sets the number of CPU threads to use (overriding any previous call to SetNumThreads). </div>
</td>
</tr>
<tr>
<td>
<code><a href="#classtflite_1_1impl_1_1_interpreter_builder_1a6abdd1e4d36ef889ad5e96e766220a42">operator=</a>(const <a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a7be86dcd93a5c9d5542ae31a62506cd4">InterpreterBuilder</a> &amp;)=delete</code>
</td>
<td>
<div>
<code><a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a7be86dcd93a5c9d5542ae31a62506cd4">InterpreterBuilder</a> &amp;</code>
</div>
</td>
</tr>
</table>
<h2>Public functions</h2>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1ae95b984f4161de8ebb0f72dde8d82552">
<h3>AddDelegate</h3>
<pre class="prettyprint">void AddDelegate(
  TfLiteDelegate *delegate
)</pre>
<div>
<p>Any delegates added with AddDelegate will be applied to the Interpreter generated by operator(), in the order that they were added. </p>
<p>(The delegate parameter passed to AddDelegate should be non-null, otherwise an error will be reported, and the call to AddDelegate will have no other effect.) The lifetime of the delegate must be at least as long as the lifetime of any Interpreter generated by this InterpreterBuilder. </p>
</div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a04a03f40adb2cf98096bafac216088d2">
<h3>AddDelegate</h3>
<pre class="prettyprint">void AddDelegate(
  TfLiteOpaqueDelegateStruct *opaque_delegate
)</pre>
<div></div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a3f1ecd25f38ae0c4145a562dcaaa6254">
<h3>InterpreterBuilder</h3>
<pre class="prettyprint"> InterpreterBuilder(
  const FlatBufferModel &amp; model,
  const <a href="/lite/api_docs/cc/class/tflite/op-resolver.html#classtflite_1_1_op_resolver">OpResolver</a> &amp; op_resolver,
  const InterpreterOptions *options_experimental
)</pre>
<div>
<p>For this constructor, the <a href="/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter">ErrorReporter</a> will be extracted from the FlatBufferModel. </p>
<p><code>options</code> object is copied during construction. So caller can release it </p>
</div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a672da7972a26dc5619d7f25f2a6a1b4d">
<h3>InterpreterBuilder</h3>
<pre class="prettyprint"> InterpreterBuilder(
  const ::tflite::Model *model,
  const <a href="/lite/api_docs/cc/class/tflite/op-resolver.html#classtflite_1_1_op_resolver">OpResolver</a> &amp; op_resolver,
  <a href="/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter">ErrorReporter</a> *error_reporter,
  const InterpreterOptions *options_experimental
)</pre>
<div>
<p>Builds an interpreter given only the raw flatbuffer Model object (instead of a FlatBufferModel). </p>
<p>Mostly used for testing. If <code>error_reporter</code> is null, then DefaultErrorReporter() is used. <code>options</code> object is copied during construction. So caller can release it </p>
</div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1afe2f489f51bf3398bcc3cf91f0f0b5d6">
<h3>InterpreterBuilder</h3>
<pre class="prettyprint"> InterpreterBuilder(
  const InterpreterBuilder &amp;
)=delete</pre>
<div></div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a6d3ddb354f27e03adc203388d3cbd2d5">
<h3>SetNumThreads</h3>
<pre class="prettyprint">TfLiteStatus SetNumThreads(
  int num_threads
)</pre>
<div>
<p>Sets the number of CPU threads to use for the interpreter. </p>
<p>Returns kTfLiteOk on success, kTfLiteError on error. </p>
</div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a8a395b526bb5fdbd126d76e6c941a22d">
<h3>SetTelemetryProfiler</h3>
<pre class="prettyprint">void SetTelemetryProfiler(
  std::unique_ptr&lt; telemetry::TelemetryProfiler &gt; profiler
)</pre>
<div></div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1affb1f0b3d91c5856c746e04f276e403d">
<h3>operator()</h3>
<pre class="prettyprint">TfLiteStatus operator()(
  std::unique_ptr&lt; <a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a2d6d829bce5eba5b241987ca5b4f0f40">Interpreter</a> &gt; *interpreter
)</pre>
<div>
<p>Builds an interpreter and stores it in <code>*interpreter</code>. </p>
<p>On success, returns kTfLiteOk and sets <code>*interpreter</code> to a valid Interpreter. On failure, returns an error status and sets <code>*interpreter</code> to nullptr. </p>
</div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a9f501d83e33b7f39cfbb5dbf37be0480">
<h3>operator()</h3>
<pre class="prettyprint">TfLiteStatus operator()(
  std::unique_ptr&lt; <a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a2d6d829bce5eba5b241987ca5b4f0f40">Interpreter</a> &gt; *interpreter,
  int num_threads
)</pre>
<div>
<p>Same as above, but also sets the number of CPU threads to use (overriding any previous call to SetNumThreads). </p>
<p>Deprecated: use the SetNumThreads method instead. </p>
</div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1a6abdd1e4d36ef889ad5e96e766220a42">
<h3>operator=</h3>
<pre class="prettyprint"><a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a7be86dcd93a5c9d5542ae31a62506cd4">InterpreterBuilder</a> &amp; operator=(
  const <a href="/lite/api_docs/cc/namespace/tflite.html#namespacetflite_1a7be86dcd93a5c9d5542ae31a62506cd4">InterpreterBuilder</a> &amp;
)=delete</pre>
<div></div>
</div>
<div id="classtflite_1_1impl_1_1_interpreter_builder_1ad58b1346e6dea8205edd0122d3feffb6">
<h3>~InterpreterBuilder</h3>
<pre class="prettyprint"> ~InterpreterBuilder()</pre>
<div></div>
</div>
</body>
</html>
